package com.rjwh.dingdong.client.mvp.model.impl;

import com.aishua.lib.task.AsResult;
import com.rjwh.dingdong.client.constant.NetConstant;
import com.rjwh.dingdong.client.mvp.BaseModel;
import com.rjwh.dingdong.client.mvp.BasePresenter;
import com.rjwh.dingdong.client.mvp.model.IMainPageModel;
import com.rjwh.dingdong.client.network.HttpWebService;
import com.rjwh.dingdong.client.network.HttpWebServiceCallBack;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Kay
 * @ClassName MainPageModel
 * @Description
 * @date 2016-10-26
 * @history 2016-10-26 author: description:
 */

public class MainPageModel extends BaseModel implements IMainPageModel, HttpWebServiceCallBack {

    public MainPageModel(BasePresenter basePresenter) {
        super(basePresenter);
    }

    /**
     * 主页
     */
    @Override
    public void doGetMainPage() {
        Map<String, String> params = new HashMap<>();
        HttpWebService.getDataFromServer(NetConstant.GETMAINPAGE, params, true, this);
    }

    @Override
    public void onServerDataAcquired(int businessType, AsResult mAsResult, boolean isRefresh) {
        if (getBasePresenter() != null) {
            getBasePresenter().onServerDataAcquired(businessType, mAsResult, isRefresh);
        }
    }
}
